"""
    Controller for test delivery table.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class TestDeliveryController(LookupController, CRUDController):
    model_object = model.TestDelivery
    lookup_columns = [
        TableCol(name='student', caption=_("Student")),
        TableCol(name='test_name', caption=_("Test name")),
        TableCol(name='date', caption=_("Date")),
        TableCol(name='grade', caption=_("Grade")),
        ]
    view_fields = [
        'studentID',
        'testID',
        'grade',
        'date',
        ]

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('test_delivery_lookup'),
            columns=self.lookup_columns,
            mass_actions_class=self.model_object,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = TestDeliveryController()
